#ifndef XABSTRACTSYNTAXTREEVALUE_H
#define XABSTRACTSYNTAXTREEVALUE_H
#include <xscript/xabstractsyntaxtree.h>
#include <astree/xabstractsyntaxtreebuilder.h>

class XAbstractSyntaxTreeValue : public XAbstractSyntaxTree {
  public:
    XAbstractSyntaxTreeValue(XTokenPtr inputToken);
    XAbstractSyntaxTreeValue(XTokenPtr inputToken, std::shared_ptr<XItem> value);
  public:
    XAbstractSyntaxTreeType getTreeType()const override {return XAbstractSyntaxTreeType_Value;}
    bool invoke(std::shared_ptr<XVariableTable> table)override;
    bool isFilled()const override {return children.size() == 1;}
  private:
};

class XAbstractSyntaxTreeCreatorValue : public XAbstractSyntaxTreeCreator {
  public:
    virtual ~XAbstractSyntaxTreeCreatorValue() = default;
    virtual bool isMatched(const XTokenBlock& tokens, uint32_t row, uint32_t col) override {return false;}
    std::shared_ptr<XAbstractSyntaxTree> create(const XTokenBlock& tokens, uint32_t row, uint32_t col, std::shared_ptr<XAbstractSyntaxTreeBuilder> builder)override;
};

class XAbstractSyntaxTreeCreatorInt : public XAbstractSyntaxTreeCreatorValue {
  public:
    bool isMatched(const XTokenBlock& tokens, uint32_t row, uint32_t col)override;
};

class XAbstractSyntaxTreeCreatorFloat : public XAbstractSyntaxTreeCreatorValue {
  public:
    bool isMatched(const XTokenBlock& tokens, uint32_t row, uint32_t col)override;
};

class XAbstractSyntaxTreeCreatorBoolean : public XAbstractSyntaxTreeCreatorValue {
  public:
    bool isMatched(const XTokenBlock& tokens, uint32_t row, uint32_t col)override;
};

class XAbstractSyntaxTreeCreatorString : public XAbstractSyntaxTreeCreatorValue {
  public:
    bool isMatched(const XTokenBlock& tokens, uint32_t row, uint32_t col)override;
};

class XAbstractSyntaxTreeList : public XAbstractSyntaxTree {
  public:
    XAbstractSyntaxTreeList(XTokenPtr inputToken);
  public:
    XAbstractSyntaxTreeType getTreeType()const override {return XAbstractSyntaxTreeType_Value;}
    bool invoke(std::shared_ptr<XVariableTable> table)override;
    bool isFilled()const override {return children.size() == 1;}
  private:
};

#endif // XABSTRACTSYNTAXTREEVALUE_H
